package ru.myrtle.umf.util;

import ru.myrtle.umf.UObject;
import ru.myrtle.umf.UReference;

public class UObjectWithInverseList<T extends UObject> extends UObjectList<T> {

    private final UObject owner;
    private final UReference inverseFeature;

    public UObjectWithInverseList(UObject owner, UReference inverseFeature) {
        this.owner = owner;
        this.inverseFeature = inverseFeature;
    }

    @Override
    protected void objectAdded(UObject object) {
        object.uInternalInverseAdd(owner, inverseFeature);
    }

    @Override
    protected void objectRemoved(UObject object) {
        object.uInternalInverseRemove(owner, inverseFeature);
    }
}
